<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="../">
<head>
  <meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>verdi_neruda &mdash; The Logtalk Handbook v3.93.0-b01 documentation</title>
      <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=d75fae25" />
      <link rel="stylesheet" type="text/css" href="../_static/css/theme.css?v=19f00094" />
      <link rel="stylesheet" type="text/css" href="../_static/css/custom.css?v=396eccfe" />

  
  <!--[if lt IE 9]>
    <script src="../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
        <script src="../_static/jquery.js?v=5d32c60e"></script>
        <script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
        <script src="../_static/documentation_options.js?v=c8100655"></script>
        <script src="../_static/doctools.js?v=9a2dae69"></script>
        <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="../_static/js/theme.js"></script>
    <!-- begin favicon -->
    <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
    <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
    <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
    <link rel="manifest" href="/site.webmanifest" />
    <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5" />
    <meta name="msapplication-TileColor" content="#355b95" />
    <meta name="theme-color" content="#ffffff" />
    <!-- end favicon -->
    
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="xml_parser" href="xml_parser.html" />
    <link rel="prev" title="pddl_parser" href="pddl_parser.html" />
   
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >

          
          
          <a href="../index.html" class="icon icon-home">
            The Logtalk Handbook
              <img src="../_static/logtalk.gif" class="logo" alt="Logo"/>
          </a>
              <div class="version">
                3.93.0
              </div>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
    
              <p class="caption" role="heading"><span class="caption-text">Contents</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../userman/index.html">User Manual</a></li>
<li class="toctree-l1"><a class="reference internal" href="../refman/index.html">Reference Manual</a></li>
<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../faq/index.html">FAQ</a></li>
<li class="toctree-l1"><a class="reference internal" href="../devtools/index.html">Developer Tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a></li>
<li class="toctree-l1"><a class="reference internal" href="../ports/index.html">Ports</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Contributions</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="flags.html"><code class="docutils literal notranslate"><span class="pre">flags</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="iso8601.html"><code class="docutils literal notranslate"><span class="pre">iso8601</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="pddl_parser.html"><code class="docutils literal notranslate"><span class="pre">pddl_parser</span></code></a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#"><code class="docutils literal notranslate"><span class="pre">verdi_neruda</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="xml_parser.html"><code class="docutils literal notranslate"><span class="pre">xml_parser</span></code></a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
<li class="toctree-l1"><a class="reference internal" href="../bibliography.html">Bibliography</a></li>
<li class="toctree-l1"><a class="reference internal" href="../genindex.html">Index</a></li>
</ul>

    <p class="caption"><span class="caption-text">External Contents</span></p>
    <ul>
    <li class="toctree-l1"><a class="reference internal" href="../../apis/index.html">APIs</a></li>
    <li class="toctree-l1"><a class="reference internal" href="https://logtalk.org">Logtalk website</a></li>
    <li class="toctree-l1"><a class="reference internal" href="https://github.com/LogtalkDotOrg/logtalk3">GitHub repo</a></li>
    </ul>
  
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../index.html">The Logtalk Handbook</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="index.html">Contributions</a></li>
      <li class="breadcrumb-item active"><code class="docutils literal notranslate"><span class="pre">verdi_neruda</span></code></li>
      <li class="wy-breadcrumbs-aside">
              <a href="https://github.com/LogtalkDotOrg/logtalk3/blob/master/docs/handbook/sources/contributions/verdi_neruda.rst" class="fa fa-github"> Edit on GitHub</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <section id="verdi-neruda">
<span id="library-verdi-neruda"></span><h1><code class="docutils literal notranslate"><span class="pre">verdi_neruda</span></code><a class="headerlink" href="#verdi-neruda" title="Link to this heading"></a></h1>
<div class="line-block">
<div class="line">Verdi Neruda - Meta-interpreter collection for Prolog.</div>
<div class="line">Release 1.0</div>
</div>
<p>Copyright (c) 2010 Victor Lagerkvist. All Rights Reserved. Verdi Neruda
is free software. You can redistribute it and/or modify it under the
terms of the simplified BSD license.</p>
<p>CONTENTS</p>
<ol class="arabic simple">
<li><p>License</p></li>
<li><p>About</p></li>
<li><p>Verdi Neruda web site</p></li>
<li><p>Installation and running</p></li>
<li><p>Examples</p></li>
<li><p>Authors</p></li>
<li><p>LICENSE</p></li>
</ol>
<p>Copyright 2010 Victor Lagerkvist. All rights reserved.</p>
<p>Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:</p>
<ol class="arabic simple">
<li><p>Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.</p></li>
<li><p>Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.</p></li>
</ol>
<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ‘’AS IS’’ AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
<p>The views and conclusions contained in the software and documentation
are those of the authors and should not be interpreted as representing
official policies, either expressed or implied, of the copyright
holders.</p>
<ol class="arabic simple" start="2">
<li><p>ABOUT</p></li>
</ol>
<p>Verdi Neruda is a meta-interpreter collection for Prolog. Or, to be more
precise, for a Prolog like language. Or, to be pedantically precise to
the point that you are annoying people, it’s not really a
meta-interpreter collection at all since the interpreters themselves
aren’t interpreting the language that they are written in. Let’s just
say that it is a collection of interpreters for a logic programming
language very much like pure Prolog with negation as finite failure.</p>
<p>Verdi Neruda is written entirely in Logtalk and compatible with most
major Prolog systems. The name is sadly not a subtle wordplay or an
acronym, but was generated by a computer with the help of a soundex
algorithm. The purpose of the interpreter suite was to compare top-down
methods to bottom-up methods and how resolution tree search rules
affected performance and completeness. In the top-down family we find
such interpreters as the long-time standing champion depth-first, its
slow but orderly brother breadth-first and the youngster iterative
deepening. A best-first framework can be found a stone throw away. With
it it’s possible to define interpreters that use greedy best-first
search as well as A* search.</p>
<p>In the bottom-up camp we find an interpreter that uses a semi naive
fixpoint construction. Since bottom-up interpreters by their very nature
are not goal oriented a transformation technique called magic
transformation is used on logic programs before any inferences are made.
This technique allows the interpreter to only generate the facts that a
top-down interpreter would have used on the same logic program.</p>
<p>A shell akin to a Prolog top loop is also included. It has commands both
for proving goals with an interpreter of choice and for benchmarking
logical inferences. If Verdi Neruda is run with a Prolog system that
supports statistics/2 it’s possible to obtain statistics such as
CPU-time as well.</p>
<ol class="arabic simple" start="3">
<li><p>VERDI NERUDA WEB SITE</p></li>
</ol>
<p>Visit the Verdi Neruda GitHub www-page at:</p>
<p><a class="reference external" href="https://github.com/Joelbyte/verdi-neruda">https://github.com/Joelbyte/verdi-neruda</a></p>
<ol class="arabic simple" start="4">
<li><p>INSTALLATION AND RUNNING</p></li>
</ol>
<p>Verdi Neruda requires Logtalk 2.40.0 or a later version.</p>
<p>To use the snapshot of Verdi Neruda bundled with Logtalk:</p>
<ul class="simple">
<li><p>Start Logtalk.</p></li>
<li><p>Type <code class="docutils literal notranslate"><span class="pre">{verdi_neruda(loader)}.</span></code> (Including <code class="docutils literal notranslate"><span class="pre">.</span></code>).</p></li>
</ul>
<p>To use the latest version of Verdi Neruda, fetch the latest source code,
either as an archive or from the git repository, extract it to a
directory of your choice, and:</p>
<ul class="simple">
<li><p>Start Logtalk from that directory.</p></li>
<li><p>Type <code class="docutils literal notranslate"><span class="pre">{loader}.</span></code> (Including <code class="docutils literal notranslate"><span class="pre">.</span></code>). If everything went according to
the plan you should be greeted by the welcoming message. If you
replace the bundled version with the new one, you can use in
alternative the steps above.</p></li>
</ul>
<ol class="arabic simple" start="5">
<li><p>EXAMPLES</p></li>
</ol>
<p>Follow the previous instructions to get everything up and running. First
we’re going to run some predefined programs in the included databases.
Begin by typing <code class="docutils literal notranslate"><span class="pre">databases.</span></code> from the shell - this should print a list
of the currently loaded databases. The demo database <code class="docutils literal notranslate"><span class="pre">demodb</span></code> should
be included in the list. Next type <code class="docutils literal notranslate"><span class="pre">listing(demodb).</span></code> to print the
contents of the database. The output should look something like:</p>
<div class="highlight-logtalk notranslate"><div class="highlight"><pre><span></span>append([],<span class="nv">A</span>,<span class="nv">A</span>) if
    <span class="k">true</span>.
append([<span class="nv">A</span>|<span class="nv">B</span>],<span class="nv">C</span>,[<span class="nv">A</span>|<span class="nv">D</span>]) if
    append(<span class="nv">B</span>,<span class="nv">C</span>,<span class="nv">D</span>).
.
.
.
</pre></div>
</div>
<p>Which means that the <code class="docutils literal notranslate"><span class="pre">append/3</span></code> program is loaded and ready for
action. Next we need to decide which interpreter to use. Fortunately the
shell does not leave much to the imagination - as might be expected, the
<code class="docutils literal notranslate"><span class="pre">interpreters.</span></code> command prints the currently loaded interpreters. The
list should look like:</p>
<div class="highlight-logtalk notranslate"><div class="highlight"><pre><span></span>dfs_interpreter
bfs_interpreter
iddfs_interpreter(<span class="nv">A</span>)
bup_interpreter
a_star_interpreter(<span class="nv">A</span>)
</pre></div>
</div>
<p>The variables means that the interpreters are parametric objects and
that additional information is needed in order to run them. The
iddfs-interpreter needs to know the increment and the A*-interpreter
needs to know what weight should be used when calculating the cost of
nodes. To start with let’s use the dfs-interpreter and do something
exciting, namely appending two lists!</p>
<div class="highlight-logtalk notranslate"><div class="highlight"><pre><span></span>prove(dfs_interpreter, append([a,b], [c,d], <span class="nv">Xs</span>), demodb).
</pre></div>
</div>
<p>The prove command takes three arguments. The first is a interpreter, the
second the goal that shall be proved and the last the database that the
clauses are derived from.</p>
<p>To accomplish the same thing with the iddfs-interpreter with an
increment of 1 we need only type</p>
<div class="highlight-logtalk notranslate"><div class="highlight"><pre><span></span>prove(iddfs_interpreter(<span class="m">1</span>), append([a,b], [c,d], <span class="nv">Xs</span>), demodb).
</pre></div>
</div>
<p>The shell also has support for counting logical inferences. To compare
the dfs- and iddfs-interpreter with the append program we could write:</p>
<div class="highlight-logtalk notranslate"><div class="highlight"><pre><span></span>benchmark(dfs_interpreter, append([a,b,c,d],[<span class="o">e</span>,f], <span class="nv">Xs</span>), demodb).  <span class="o">-&gt;</span>
dfs_interpreter inferences<span class="o">:</span> <span class="m">5</span>

benchmark(iddfs_interpreter(<span class="m">1</span>), append([a,b,c,d],[<span class="o">e</span>,f], <span class="nv">Xs</span>), demodb).
<span class="o">-&gt;</span> iddfs_interpreter(<span class="m">1</span>) inferences<span class="o">:</span> <span class="m">15</span>
</pre></div>
</div>
<p>For more information regarding the built in shell commands consult the
‘help.’ command.</p>
<ol class="arabic simple" start="6">
<li><p>AUTHORS</p></li>
</ol>
<p>The bulk of Verdi Neruda was written by Victor Lagerkvist during his
bachelor thesis at Linköping university in the spring of 2010. Paulo
Moura also helped a great deal during the later stages of development,
especially with regards to compatibility between various Prolog systems.</p>
</section>


           </div>
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="pddl_parser.html" class="btn btn-neutral float-left" title="pddl_parser" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="xml_parser.html" class="btn btn-neutral float-right" title="xml_parser" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 1998-2025, Paulo Moura.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>